<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>JSP - Hello World</title>
</head>
<body>
<%
    Class.forName("com.mysql.jdbc.Driver");
    String url = "jdbc:mysql://127.0.0.1:3306/dbnews";
    String username = "root";
    String password = "1234";
    Connection connection = DriverManager.getConnection(url, username, password);
    if (connection != null) {
        out.print("数据库连接成功!");
    }

%>
<br/>
<a href="hello-servlet">Hello Servlet</a>
</body>
</html>